package com.maxmlr.music.admin.service.transfer;

import com.google.common.collect.Maps;
import com.maxmlr.music.admin.entity.Dept;
import com.maxmlr.music.admin.param.TreeParam;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @ClassName DeptTransfer
 * @Description TODO
 * @Author maxiao
 * @Date 2020/6/15 下午2:51
 * @Version V1.0
 */
@Component
public class DeptTransfer {


    public TreeParam<Dept> po2TreeParam(Dept dept) {
        TreeParam<Dept> tree = new TreeParam<Dept>();
        tree.setId(dept.getId().toString());
        tree.setParentId(dept.getParentId().toString());
        tree.setText(dept.getName());
        Map<String, Object> state = Maps.newHashMap();
        state.put("opened", true);
        tree.setState(state);
        return tree;
    }
}
